#ifndef MAIN_FUNC_H
#define MAIN_FUNC_H
#include <OneButton.h>
#include <Ticker.h> //导入定时器库
#include "blefunc.h"

typedef void (*TimerCallBack)(long);

enum WAKEUP_MODE
{
    GPIO_MODE,
    TIMER_MODE,
    GPIO_TIMER_MODE
};

void sendNotify(String msg);
int getStrength(int points);
 
void timerCallback();
void attachGlobalTimer();
void dettachGlobalTimer();
 
int print_wakeup_reason();

bool isBootByWakeup();
 

void setSleepMode(WAKEUP_MODE mode);
WAKEUP_MODE getSleepMode();

void startSleep(long delaySecond);

void cancelSleep();
void handleLongClickStart();
void attachButtonClick();
void loopBtn();
void excuteTimerAction();
void attachGlobalTimer();
void dettachGlobalTimer();
void setupWatchDog();
void feedWatchDog();
void setupMain();
void loopMain();
void setButtonPin(int pin);

void setClickButtonLight();

void checkLowPower();
bool checkLowPowerBoot();
bool isReadySleep();
void attachButtonCheckTimer();
void dettachButtonCheckTimer();

#endif